import { mobxState } from "@/data";
import filterHideMenu from "./filterHideMenu";



/**
 * 
 * @param {routerPath} routerPath 
 * @description 传入路由url 获取整个路由信息
 * @returns 
 */
const getRouteInfo = (routerPath) => {
    const routes = filterHideMenu(mobxState.routes);
    let route = null;
    const getRoute = (list = []) => {
        for (var i = 0; i < list.length; i++) {
            if (list[i].routerPath === routerPath) {
                route = list[i];
                break;
            }
            if (list[i].children && list[i].children.length > 0) {
                getRoute(list[i].children)
            }
        }
    }
    getRoute(routes)
    // console.log("拿到信息：", route)
    return route

}

export default getRouteInfo;